<?php

/**
 * Dicfro
 *
 * PHP 5
 *
 * @category   DicFro
 * @package    View
 * @subpackage Scripts_Interface
 * @author     Michel Corne <mcorne@yahoo.com>
 * @copyright  2008-2013 Michel Corne
 * @license    http://opensource.org/licenses/gpl-3.0.html GNU GPL v3
 */

?>

<div id="tabs">

<hr class="tabs" />

<?php if($this->definition):?>
  <?php if($this->dictionary['id'] == 'roman-lexicon'):?>
    <a class="tab-selected" id="content-tab"
       href="javascript: updateTabContents('content-tab');" ><?=$this->translate('Vocabulary');?></a>

  <?php else:?>
    <a class="tab-selected" id="content-tab"
       href="javascript: updateTabContents('content-tab');" ><?=$this->translate('Definitions');?></a>
  <?php endif;?>

<?php endif;?>

<?php if($this->errataImages or $this->errataText):?>

  <a class="tab" id="errata-tab"
     href="javascript: updateTabContents('errata-tab');" ><?=$this->translate('Corrections');?></a>

<?php endif;?>

<?php if($this->ghostwords):?>

  <a class="tab" id="ghostwords-tab"
     href="javascript: updateTabContents('ghostwords-tab'); getGhostwordNotice()"
     title="Base des mots fantômes de l'ATILF"
     ><?=$this->translate('Ghost words');?></a>

  <select class="ghostwords-tab" id="ghostword-select"
          onclick="updateTabContents('ghostwords-tab'); getGhostwordNotice()"
          onchange="getGhostwordNotice(true)"
          <?php if(count($this->ghostwords) == 1):?>disabled="disabled"<?php endif;?> >

    <?php foreach($this->ghostwords as $ghostword):?>
      <option><?=$ghostword;?></option>
    <?php endforeach;?>

  </select>

<?php endif;?>

<?php if($this->identifiedWords):?>

  <span class="identified"
        title="Tobler-Lommatzsch: Altfranzösisches Wörterbuch - Lemmaliste">
    <?=$this->translate('Identified words');?>
  </span>

  <select class="identified"
          onchange="searchWord('<?=$this->linksHelper->setWordLink();?>', this.value)" >

    <option><?=$this->escape($this->word);?></option>

    <?php
      if($forms = $this->wordsHelper->extractForms('main')) {
          $label = $this->translate('Principal forms');
          require "{$this->viewsDir}/interface/words-optgroup.phtml";
      }
    ?>

    <?php
      if($forms = $this->wordsHelper->extractForms('variants')) {
          $label = $this->translate('Variant forms');
          require "{$this->viewsDir}/interface/words-optgroup.phtml";
      }
    ?>

    <?php
      if($forms = $this->wordsHelper->extractOtherForms()) {
          $label = $this->translate('Other forms');
          require "{$this->viewsDir}/interface/words-optgroup.phtml";
      }
    ?>

  </select>

<?php endif;?>

<?php if($this->identifiedLatinWords):?>

  <span class="identified"
        title="Whitaker Latin-English dictionary - Wordlist">
    <?=$this->translate('Identified words');?>
  </span>

  <select class="identified"
          onchange="searchWord('<?=$this->linksHelper->setWordLink();?>', this.value)" >

    <option value=""><?=$this->escape($this->word);?></option>

    <optgroup label="<?=count($this->identifiedLatinWords) > 1 ? $this->translate('Other forms') : $this->translate('Other form');?>">

    <?php foreach($this->identifiedLatinWords as $word):?>
      <option value="<?=$word;?>"><?=$word;?></option>
    <?php endforeach;?>

    </optgroup>

  </select>

<?php endif;?>

<?php
    if($verbs = $this->verbsHelper->extractIdentifiedVerbs()) {
        $title = "Tableaux de conjugaison de l'ancien français";
        $label = $this->translate('Identified verbs');
        require "{$this->viewsDir}/interface/verbs-select.phtml";
    }
?>

<!-- lexique roman page and volume block -->
<?php if($this->dictionary['id'] == 'roman-lexicon'):?>

  <a class="tab" id="lexromd-tab"
     href="javascript: updateTabContents(document.getElementById('lexromd-img').src? 'lexromd-tab' : 'lexromd-help-tab')"
     ><?=$this->translate('Definitions');?></a>

  <span class="tome"><?=$this->translate('Tome');?></span>

  <select class="tome" id="tome">
    <option></option>
    <option value="2">II</option>
    <option value="3">III</option>
    <option value="4">IV</option>
    <option value="5">V</option>
    <option value="6">VI</option>
  </select>

  <span class="page"><?=$this->translate('Page');?></span>

  <input class="page" type="text" id="tome-page"
         title="<?=$this->translate('Enter a number then press the ENTER key or click on the button');?>"
         onkeypress="isEnterKey(event) && displayLexromd('<?=$this->setLinkUrl('dictionary/roman-lexicon/lexromd/mImg/%s-%s.gif');?>');" />

  <input class="button" type="button"
         onclick="displayLexromd('<?=$this->setLinkUrl('dictionary/roman-lexicon/lexromd/mImg/%s-%s.gif');?>')"
         value="<?=$this->translate('Display');?>" />

  <a class="tab" id="lexromd-help-tab"
     href="javascript: updateTabContents('lexromd-help-tab')"
     ><?=$this->translate('Help');?></a>

<?php endif;?>

<?php if($this->tcaf !== null):?>

  <a class="tab-selected" id="content-tab"
     title="Définitions des mots"
     href="javascript: updateTabContents('content-tab');" ><?=$this->translate('');?>Conjugaisons</a>

  <?php
    if($verbs = $this->verbsHelper->extractComposedVerbs(0)) {
        $title = "Tableaux de conjugaison de l'ancien français";
        $label = $this->translate('Similar verbs');
        require "{$this->viewsDir}/interface/verbs-select.phtml";
    }
  ?>

  <?php
    if($verbs = $this->verbsHelper->extractComposedVerbs(1)) {
        $title = "Tableaux de conjugaison de l'ancien français";
        $label = $this->translate('Derived verbs');
        require "{$this->viewsDir}/interface/verbs-select.phtml";
    }
  ?>

<?php endif;?>

</div>